package com.yserp.project.erp.order.productorder.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yserp.common.utils.mybatis.MybatisPlusUtil;
import com.yserp.project.erp.order.productorder.domain.ProductionOrderItem;
import com.yserp.project.erp.order.productorder.mapper.ProductionOrderItemMapper;
import com.yserp.project.erp.order.productorder.service.IProductionOrderItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商品入库单子Service业务层处理
 *
 * @author yserp
 * @date 2022-07-19
 */
@Service
public class ProductionOrderItemServiceImpl extends ServiceImpl<ProductionOrderItemMapper, ProductionOrderItem> implements IProductionOrderItemService {

    @Resource
    private ProductionOrderItemMapper productionOrderItemMapper;


    @Override
    public List<ProductionOrderItem> selectProductionOrderItemList(ProductionOrderItem productionOrderItem) {
        QueryWrapper<ProductionOrderItem> queryWrapper = new QueryWrapper<>();
        MybatisPlusUtil.notNullField(productionOrderItem,queryWrapper);
        return productionOrderItemMapper.selectList(queryWrapper);
    }

    @Override
    public List<ProductionOrderItem> selectProductionOrderItemListByMainId(Long mainId) {
        return productionOrderItemMapper.selectList(new QueryWrapper<ProductionOrderItem>().eq("main_id" , mainId));
    }


}
